package mumu.android.view;


import mumu.android.R;
import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ProgressBar;

public class loading2 extends Activity {
	 int i = 0;
	  Handler handler ;
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setTitle(this.getClass().getName());
		setContentView(R.layout.loading2);
		
		 /*set it to be full screen*/ 
        //getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,    
        //WindowManager.LayoutParams.FLAG_FULLSCREEN); 
		final ProgressBar pbar = (ProgressBar) findViewById(R.id.progress_1);
		pbar.setMax(100);
		
		handler= new Handler() {
			@Override
			public void handleMessage(Message msg) {
				super.handleMessage(msg);
				i++;
				if (i <= 100)
					handler.sendEmptyMessageDelayed(1, 1000);
				pbar.setProgress(i);

			}
		};
		findViewById(R.id.btn_1).setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				handler.sendEmptyMessageDelayed(1, 1000);
			}
		});
	}

}
